package com.zzyl.nursing.controller.member;

import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.AjaxResult;
import com.zzyl.common.core.domain.R;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.nursing.domain.NursingProject;
import com.zzyl.nursing.mapper.NursingProjectMapper;
import com.zzyl.nursing.service.INursingProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/member/orders/project")
public class MemberOrderProjectController extends BaseController {
    @Autowired
    private INursingProjectService nursingProjectService;
    @GetMapping("/page")
    public TableDataInfo<List<NursingProject>> getPage(NursingProject nursingProject){
        //startPage();是分页插件的开始分页方法，紧跟着的sql语句是分页查询的sql语句
        startPage();
        List<NursingProject> nursingProjects = nursingProjectService.selectNursingProjectList(nursingProject);
        return getDataTable(nursingProjects);
    }
//    @GetMapping("/{id}")
//    public R<NursingProject> getById(@PathVariable Integer id){
//        return R.ok(nursingProjectService.getById(id));
//    }
      @GetMapping("/{id}")
      public AjaxResult getById(@PathVariable Integer id) {
          return AjaxResult.success(nursingProjectService.getById(id));
      }

}
